package com.RMP
{
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;
    import flash.utils.*;
    import com.greensock.*;

    public class BookmarksBigImageShell extends Sprite
    {
        var btnField:TextField;
        public var myXMLList:XMLList;
        var loader:Loader;
        var thebar:Sprite;
        var loaderbar:LoaderBar;
        var myURL:String;
        var fadeSpeed:Number;
        var projTitle:ShortTextBold;
        var closeBtn:Sprite;
        var bg:Sprite;
        var image:Bitmap;
        public var projId:int;
        var fsBtn:Sprite;
        var minus:Sprite;
        var frame:Frame;
        var fieldFormat:TextFormat;
        var plus:Sprite;
        var myRoot:MovieClip;
        var rArrow:Sprite;
        var currId:int;
        var lArrow:Sprite;

        public function BookmarksBigImageShell(param1:MovieClip, param2:Number, param3:XMLList, param4:int) : void
        {
            visible = false;
            alpha = 0;
            myRoot = param1;
            fadeSpeed = param2;
            myXMLList = param3;
            projId = param4;
            myRoot.stage.addEventListener(Event.RESIZE, onResizer, false, 0, true);
            bg = new Sprite();
            bg.buttonMode = true;
            addChild(bg);
            bg.graphics.beginFill(16777215, 100);
            bg.graphics.drawRect(0, 0, 1, 1);
            bg.graphics.endFill();
            bg.addEventListener(MouseEvent.CLICK, closeClick, false, 0, true);
            bg.addEventListener(MouseEvent.MOUSE_OVER, closeRollOver);
            bg.addEventListener(MouseEvent.MOUSE_OUT, closeRollOut);
            addChild(bg);
            buildArrows();
            loaderbar = new LoaderBar(myRoot, Math.round(4 * myRoot.unitW + 3 * myRoot.gutterW), 1, 15592941, 16724736);
            loaderbar.alpha = 0;
            addChild(loaderbar);
            projTitle = new ShortTextBold(param1, "", 0);
            projTitle.buttonMode = true;
            projTitle.useHandCursor = true;
            projTitle.mouseChildren = false;
            projTitle.addEventListener(MouseEvent.CLICK, projTitleClick, false, 0, true);
            projTitle.addEventListener(MouseEvent.MOUSE_OVER, projTitleRollOver);
            projTitle.addEventListener(MouseEvent.MOUSE_OUT, projTitleRollOut);
            projTitle.alpha = 0;
            addChild(projTitle);
            return;
        }

        function closeRollOver(event:MouseEvent) : void
        {
            return;
        }

        function projTitleRollOver(event:MouseEvent) : void
        {
            TweenMax.to(projTitle.field, fadeSpeed, {tint:myRoot.hotColor, overwrite:true});
            return;
        }

        public function loadImage(param1:int)
        {
            var incomingId:* = param1;
            currId = incomingId;
            if (image != null)
            {
                image.smoothing = false;
            }
            loaderbar.progressSprite.width = 0;
            TweenMax.to(loaderbar, fadeSpeed, {alpha:1, overwrite:true, delay:fadeSpeed});
            loader = new Loader();
            var _loc_4:int = 0;
            var _loc_5:* = myXMLList;
            var _loc_3:* = new XMLList("");
            for each (_loc_6 in _loc_5)
            {
                
                var _loc_7:* = _loc_5[_loc_4];
                with (_loc_5[_loc_4])
                {
                    if (@id == incomingId)
                    {
                        _loc_3[_loc_4] = _loc_6;
                    }
                }
            }
            loader.load(new URLRequest(myRoot.path + _loc_3.thumbnail.@url));
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
            minus.visible = true;
            if (myRoot.localImagesXML.image.length() == 1)
            {
                lArrow.visible = false;
                rArrow.visible = false;
            }
            else
            {
                lArrow.visible = true;
                rArrow.visible = true;
            }
            return;
        }

        public function fadeOutShell() : void
        {
            if (frame != null)
            {
                TweenMax.to(frame, fadeSpeed, {alpha:0, overwrite:true, onComplete:function ()
            {
                if (frame != null)
                {
                    removeChild(frame);
                    frame = null;
                }
                return;
            }
            });
            }
            TweenMax.to(image, fadeSpeed, {alpha:0, overwrite:true, onComplete:function ()
            {
                killImage();
                return;
            }
            });
            TweenMax.to(thebar, fadeSpeed, {alpha:0, overwrite:true});
            TweenMax.to(this, fadeSpeed, {alpha:0, overwrite:true, delay:fadeSpeed, onComplete:function ()
            {
                visible = false;
                return;
            }
            });
            TweenMax.to(projTitle, fadeSpeed, {alpha:0, overwrite:true});
            return;
        }

        function projTitleRollOut(event:MouseEvent) : void
        {
            TweenMax.to(projTitle.field, fadeSpeed, {tint:myRoot.coldColor, overwrite:true});
            return;
        }

        function arrowRollOver(event:MouseEvent) : void
        {
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.hotColor, overwrite:true});
            if (event.currentTarget.name == "closeBtn")
            {
                btnField.text = "Close";
                btnField.setTextFormat(fieldFormat);
            }
            else if (event.currentTarget.name == "fsBtn")
            {
                btnField.text = "Remove Bookmark";
                btnField.setTextFormat(fieldFormat);
            }
            else if (event.currentTarget.name == "lArrow")
            {
                btnField.text = "Previous";
                btnField.setTextFormat(fieldFormat);
            }
            else if (event.currentTarget.name == "rArrow")
            {
                btnField.text = "Next";
                btnField.setTextFormat(fieldFormat);
            }
            return;
        }

        function doResize() : void
        {
            var _loc_1:* = undefined;
            bg.width = myRoot.gridCurrW + 3;
            bg.height = myRoot.gridCurrH + 3;
            if (image != null)
            {
                var _loc_2:* = myRoot.unitW / 75;
                image.scaleY = myRoot.unitW / 75;
                image.scaleX = _loc_2;
                image.width = Math.round(image.width);
                image.height = Math.round(image.height);
                if (image.height >= bg.height - 20)
                {
                    if (myRoot.gridY == 0)
                    {
                        image.y = 0;
                        var _loc_2:* = myRoot.unitW / 75;
                        image.scaleY = myRoot.unitW / 75;
                        image.scaleX = _loc_2;
                        image.width = Math.round(image.width);
                        image.height = Math.round(image.height);
                        if (image.height >= myRoot.stage.stageHeight - 47)
                        {
                            image.height = Math.round(myRoot.stage.stageHeight - 47);
                            image.scaleX = image.scaleY;
                            image.width = Math.round(image.width);
                        }
                    }
                    else
                    {
                        if (image.height >= bg.height - 20)
                        {
                            image.height = Math.round(bg.height - 20);
                            image.scaleX = image.scaleY;
                            image.width = Math.round(image.width);
                        }
                        _loc_1 = myRoot.stage.stageHeight - myRoot.gridY - image.height;
                    }
                }
            }
            if (myRoot.gridY == 0)
            {
                thebar.y = Math.round(bg.height - 20 * myRoot.unitW / 75);
            }
            else
            {
                thebar.y = Math.round(bg.height - 10 * myRoot.unitW / 75);
            }
            if (loaderbar != null)
            {
                loaderbar.x = Math.round(10 * (myRoot.unitW + myRoot.gutterW));
                loaderbar.y = Math.round(thebar.y + 3);
                loaderbar.width = Math.round(2 * myRoot.unitW + 1 * myRoot.gutterW);
                loaderbar.height = 1;
            }
            thebar.x = 0;
            closeBtn.x = 0;
            fsBtn.x = 19;
            lArrow.x = 39;
            rArrow.x = 54;
            if (lArrow.visible == false)
            {
                btnField.x = 37;
            }
            else
            {
                btnField.x = 65;
            }
            var _loc_2:* = myRoot.unitW / 75;
            btnField.scaleY = myRoot.unitW / 75;
            btnField.scaleX = _loc_2;
            btnField.y = Math.round(-6 * myRoot.unitW / 75);
            if (frame != null)
            {
                frame.resizeFrame(image.width, image.height);
            }
            projTitle.x = -3;
            projTitle.y = Math.round(thebar.y + 9 + 6 * myRoot.unitW / 75);
            var _loc_2:* = myRoot.unitW / 75;
            projTitle.field.scaleY = myRoot.unitW / 75;
            projTitle.field.scaleX = _loc_2;
            return;
        }

        function arrowRollOut(event:MouseEvent) : void
        {
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.coldColor, overwrite:true});
            btnField.text = "";
            return;
        }

        function onResizer(event:Event)
        {
            doResize();
            return;
        }

        function projTitleClick(event:MouseEvent) : void
        {
            var e:* = event;
            dispatchEvent(new ClickCloseEvent());
            var _loc_4:int = 0;
            var _loc_5:* = myXMLList;
            var _loc_3:* = new XMLList("");
            for each (_loc_6 in _loc_5)
            {
                
                var _loc_7:* = _loc_5[_loc_4];
                with (_loc_5[_loc_4])
                {
                    if (@id == currId)
                    {
                        _loc_3[_loc_4] = _loc_6;
                    }
                }
            }
            var _loc_4:int = 0;
            var _loc_5:* = myXMLList;
            var _loc_3:* = new XMLList("");
            for each (_loc_6 in _loc_5)
            {
                
                var _loc_7:* = _loc_5[_loc_4];
                with (_loc_5[_loc_4])
                {
                    if (@id == currId)
                    {
                        _loc_3[_loc_4] = _loc_6;
                    }
                }
            }
            setTimeout(updateAddress, 2 * fadeSpeed * 1000, _loc_3.@type, _loc_3.@parentId);
            return;
        }

        function progressHandler(event:ProgressEvent) : void
        {
            var _loc_2:* = undefined;
            _loc_2 = Math.round(event.bytesLoaded / event.bytesTotal * loaderbar.bgSprite.width);
            loaderbar.tweenTo(_loc_2, fadeSpeed);
            return;
        }

        function closeClick(event:MouseEvent) : void
        {
            dispatchEvent(new ClickCloseEvent());
            return;
        }

        function buildArrows() : void
        {
            thebar = new Sprite();
            addChild(thebar);
            closeBtn = new Sprite();
            closeBtn.graphics.beginFill(10066329, 0);
            closeBtn.graphics.drawRect(-10, -10, 24, 30);
            closeBtn.graphics.endFill();
            closeBtn.graphics.beginFill(myRoot.coldColor, 100);
            closeBtn.graphics.drawRect(1, 0, 1, 1);
            closeBtn.graphics.drawRect(7, 0, 1, 1);
            closeBtn.graphics.drawRect(0, 1, 3, 1);
            closeBtn.graphics.drawRect(6, 1, 3, 1);
            closeBtn.graphics.drawRect(1, 2, 3, 1);
            closeBtn.graphics.drawRect(5, 2, 3, 1);
            closeBtn.graphics.drawRect(2, 3, 5, 1);
            closeBtn.graphics.drawRect(3, 4, 3, 1);
            closeBtn.graphics.drawRect(2, 5, 5, 1);
            closeBtn.graphics.drawRect(1, 6, 3, 1);
            closeBtn.graphics.drawRect(5, 6, 3, 1);
            closeBtn.graphics.drawRect(0, 7, 3, 1);
            closeBtn.graphics.drawRect(6, 7, 3, 1);
            closeBtn.graphics.drawRect(1, 8, 1, 1);
            closeBtn.graphics.drawRect(7, 8, 1, 1);
            closeBtn.graphics.endFill();
            closeBtn.buttonMode = true;
            closeBtn.name = "closeBtn";
            closeBtn.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
            closeBtn.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
            closeBtn.addEventListener(MouseEvent.CLICK, arrowClick);
            thebar.addChild(closeBtn);
            fsBtn = new Sprite();
            fsBtn.graphics.beginFill(10066329, 0);
            fsBtn.graphics.drawRect(-5, -10, 19, 30);
            fsBtn.graphics.endFill();
            fsBtn.buttonMode = true;
            fsBtn.name = "fsBtn";
            fsBtn.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
            fsBtn.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
            fsBtn.addEventListener(MouseEvent.CLICK, arrowClick);
            thebar.addChild(fsBtn);
            minus = new Sprite();
            minus.graphics.beginFill(7829367, 1);
            minus.graphics.drawRect(0, 8, 10, 2);
            minus.graphics.endFill();
            minus.y = -5;
            fsBtn.addChild(minus);
            lArrow = new Sprite();
            lArrow.graphics.beginFill(myRoot.hotColor, 0);
            lArrow.graphics.drawRect(-5, -10, 15, 30);
            lArrow.graphics.endFill();
            lArrow.graphics.beginFill(myRoot.coldColor, 100);
            lArrow.graphics.drawRect(0, 4, 1, 1);
            lArrow.graphics.drawRect(1, 3, 1, 3);
            lArrow.graphics.drawRect(2, 2, 1, 5);
            lArrow.graphics.drawRect(3, 1, 1, 7);
            lArrow.graphics.drawRect(4, 0, 1, 9);
            lArrow.graphics.endFill();
            lArrow.buttonMode = true;
            lArrow.name = "lArrow";
            lArrow.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
            lArrow.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
            lArrow.addEventListener(MouseEvent.CLICK, arrowClick);
            rArrow = new Sprite();
            rArrow.graphics.beginFill(myRoot.hotColor, 0);
            rArrow.graphics.drawRect(-5, -10, 15, 30);
            rArrow.graphics.endFill();
            rArrow.graphics.beginFill(myRoot.coldColor, 100);
            rArrow.graphics.drawRect(0, 0, 1, 9);
            rArrow.graphics.drawRect(1, 1, 1, 7);
            rArrow.graphics.drawRect(2, 2, 1, 5);
            rArrow.graphics.drawRect(3, 3, 1, 3);
            rArrow.graphics.drawRect(4, 4, 1, 1);
            rArrow.graphics.endFill();
            rArrow.buttonMode = true;
            rArrow.name = "rArrow";
            rArrow.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
            rArrow.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
            rArrow.addEventListener(MouseEvent.CLICK, arrowClick);
            if (myXMLList.length() > 1)
            {
                thebar.addChild(lArrow);
                thebar.addChild(rArrow);
            }
            fieldFormat = new TextFormat();
            fieldFormat.font = new HelveticaLightEmbed().fontName;
            fieldFormat.size = 14;
            fieldFormat.letterSpacing = 0;
            fieldFormat.leftMargin = 0;
            fieldFormat.rightMargin = 0;
            fieldFormat.color = myRoot.hotColor;
            btnField = new TextField();
            btnField.name = "btnField";
            btnField.autoSize = "left";
            btnField.antiAliasType = AntiAliasType.ADVANCED;
            btnField.gridFitType = GridFitType.SUBPIXEL;
            btnField.selectable = false;
            btnField.embedFonts = true;
            btnField.text = "";
            btnField.setTextFormat(fieldFormat);
            thebar.addChild(btnField);
            return;
        }

        function killImage()
        {
            if (image != null)
            {
                removeChild(image);
                image = null;
            }
            return;
        }

        function closeRollOut(event:MouseEvent) : void
        {
            return;
        }

        function buildImage() : void
        {
            image = Bitmap(loader.content);
            doResize();
            image.alpha = 0;
            addChild(image);
            var _loc_3:int = 0;
            var _loc_4:* = myXMLList;
            var _loc_2:* = new XMLList("");
            for each (_loc_5 in _loc_4)
            {
                
                var _loc_6:* = _loc_4[_loc_3];
                with (_loc_4[_loc_3])
                {
                    if (@id == currId)
                    {
                        _loc_2[_loc_3] = _loc_5;
                    }
                }
            }
            if (_loc_2.thumbnail.@border == "1")
            {
                frame = new Frame();
                frame.alpha = 0;
                addChild(frame);
                frame.resizeFrame(image.width, image.height);
                if (alpha == 1)
                {
                    TweenMax.to(frame, fadeSpeed, {alpha:1, overwrite:true});
                }
                else
                {
                    TweenMax.to(frame, fadeSpeed, {alpha:1, overwrite:true, delay:fadeSpeed});
                }
            }
            if (alpha == 1)
            {
                TweenMax.to(image, fadeSpeed, {alpha:1, overwrite:true, onComplete:function ()
            {
                if (visible == true)
                {
                    image.smoothing = true;
                }
                return;
            }
            });
            }
            else
            {
                TweenMax.to(image, fadeSpeed, {alpha:1, overwrite:true, delay:fadeSpeed, onComplete:function ()
            {
                if (visible == true)
                {
                    image.smoothing = true;
                }
                return;
            }
            });
            }
            loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
            loader = null;
            var _loc_3:int = 0;
            var _loc_4:* = myXMLList;
            var _loc_2:* = new XMLList("");
            for each (_loc_5 in _loc_4)
            {
                
                var _loc_6:* = _loc_4[_loc_3];
                with (_loc_4[_loc_3])
                {
                    if (@id == currId)
                    {
                        _loc_2[_loc_3] = _loc_5;
                    }
                }
            }
            projTitle.field.text = _loc_2.shortTitle;
            TweenMax.to(projTitle, fadeSpeed, {alpha:1, overwrite:true});
            return;
        }

        function onLoadComplete(event:Event) : void
        {
            var event:* = event;
            loaderbar.finishTween(fadeSpeed / 5);
            TweenMax.to(loaderbar, fadeSpeed, {alpha:0, overwrite:true});
            if (image == null)
            {
                buildImage();
            }
            else
            {
                if (frame != null)
                {
                    TweenMax.to(frame, fadeSpeed, {alpha:0, overwrite:true});
                }
                TweenMax.to(projTitle, fadeSpeed, {alpha:0, overwrite:true});
                TweenMax.to(image, fadeSpeed, {alpha:0, overwrite:true, onComplete:function ()
            {
                if (frame != null)
                {
                    removeChild(frame);
                    frame = null;
                }
                removeChild(image);
                image = null;
                buildImage();
                return;
            }
            });
            }
            return;
        }

        public function fadeOutShell2() : void
        {
            TweenMax.to(this, fadeSpeed, {alpha:0, overwrite:true, onComplete:function ()
            {
                visible = false;
                return;
            }
            });
            return;
        }

        public function loadNextImage(param1:int) : void
        {
            loadImage(param1);
            return;
        }

        function updateAddress(param1:String, param2) : void
        {
            var incomingType:* = param1;
            var incomingId:* = param2;
            switch(incomingType)
            {
                case "Awards":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "awards" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Partners":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "partners" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "New York Staff":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "staff" + "/" + "new-york" + "/" + "senior-staff" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Los Angeles Staff":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "staff" + "/" + "los-angeles" + "/" + "senior-staff" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Press Publications":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "press" + "/" + "publications" + "/" + "archive" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Press Releases":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "press" + "/" + "releases" + "/" + "archive" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Lectures":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "lectures" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Books":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "books" + "/" + "archive" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Selected Text":
                {
                    myRoot.clickPathNames = [""];
                    myRoot.updateAddress("/" + "practice" + "/" + "selected-text" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Press Video":
                {
                    myRoot.updateAddress("/" + "practice" + "/" + "press" + "/" + "video" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    break;
                }
                case "Architecture":
                {
                    var _loc_5:int = 0;
                    var _loc_8:int = 0;
                    var _loc_11:int = 0;
                    var _loc_12:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_10:* = new XMLList("");
                    for each (_loc_13 in _loc_12)
                    {
                        
                        var _loc_14:* = _loc_12[_loc_11];
                        with (_loc_12[_loc_11])
                        {
                            if (@label == "Architecture")
                            {
                                _loc_10[_loc_11] = _loc_13;
                            }
                        }
                    }
                    var _loc_9:* = _loc_10.tier1;
                    var _loc_7:* = new XMLList("");
                    for each (_loc_10 in _loc_9)
                    {
                        
                        var _loc_11:* = _loc_9[_loc_8];
                        with (_loc_9[_loc_8])
                        {
                            if (@label == "Name")
                            {
                                _loc_7[_loc_8] = _loc_10;
                            }
                        }
                    }
                    var _loc_6:* = _loc_7.tier2.item;
                    var _loc_4:* = new XMLList("");
                    for each (_loc_7 in _loc_6)
                    {
                        
                        var _loc_8:* = _loc_6[_loc_5];
                        with (_loc_6[_loc_5])
                        {
                            if (@id == incomingId)
                            {
                                _loc_4[_loc_5] = _loc_7;
                            }
                        }
                    }
                    if (_loc_4.@sub == "T")
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                    }
                    else
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    }
                    break;
                }
                case "Products":
                {
                    var _loc_5:int = 0;
                    var _loc_8:int = 0;
                    var _loc_11:int = 0;
                    var _loc_12:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_10:* = new XMLList("");
                    for each (_loc_13 in _loc_12)
                    {
                        
                        var _loc_14:* = _loc_12[_loc_11];
                        with (_loc_12[_loc_11])
                        {
                            if (@label == "Products")
                            {
                                _loc_10[_loc_11] = _loc_13;
                            }
                        }
                    }
                    var _loc_9:* = _loc_10.tier1;
                    var _loc_7:* = new XMLList("");
                    for each (_loc_10 in _loc_9)
                    {
                        
                        var _loc_11:* = _loc_9[_loc_8];
                        with (_loc_9[_loc_8])
                        {
                            if (@label == "Name")
                            {
                                _loc_7[_loc_8] = _loc_10;
                            }
                        }
                    }
                    var _loc_6:* = _loc_7.tier2.item;
                    var _loc_4:* = new XMLList("");
                    for each (_loc_7 in _loc_6)
                    {
                        
                        var _loc_8:* = _loc_6[_loc_5];
                        with (_loc_6[_loc_5])
                        {
                            if (@id == incomingId)
                            {
                                _loc_4[_loc_5] = _loc_7;
                            }
                        }
                    }
                    if (_loc_4.@sub == "T")
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "products" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                    }
                    else
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "products" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    }
                    break;
                }
                case "Exhibitions":
                {
                    var _loc_5:int = 0;
                    var _loc_8:int = 0;
                    var _loc_11:int = 0;
                    var _loc_12:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_10:* = new XMLList("");
                    for each (_loc_13 in _loc_12)
                    {
                        
                        var _loc_14:* = _loc_12[_loc_11];
                        with (_loc_12[_loc_11])
                        {
                            if (@label == "Exhibitions")
                            {
                                _loc_10[_loc_11] = _loc_13;
                            }
                        }
                    }
                    var _loc_9:* = _loc_10.tier1;
                    var _loc_7:* = new XMLList("");
                    for each (_loc_10 in _loc_9)
                    {
                        
                        var _loc_11:* = _loc_9[_loc_8];
                        with (_loc_9[_loc_8])
                        {
                            if (@label == "Name")
                            {
                                _loc_7[_loc_8] = _loc_10;
                            }
                        }
                    }
                    var _loc_6:* = _loc_7.tier2.item;
                    var _loc_4:* = new XMLList("");
                    for each (_loc_7 in _loc_6)
                    {
                        
                        var _loc_8:* = _loc_6[_loc_5];
                        with (_loc_6[_loc_5])
                        {
                            if (@id == incomingId)
                            {
                                _loc_4[_loc_5] = _loc_7;
                            }
                        }
                    }
                    if (_loc_4.@sub == "T")
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "exhibitions" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                    }
                    else
                    {
                        myRoot.clickPathNames = [""];
                        myRoot.updateAddress("/" + "projects" + "/" + "exhibitions" + "/" + "name" + "/" + 0 + "/" + incomingId + "/" + 0 + "/");
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }

        public function fadeInShell() : void
        {
            doResize();
            visible = true;
            thebar.alpha = 1;
            TweenMax.to(this, fadeSpeed, {alpha:1, overwrite:true});
            return;
        }

        function arrowClick(event:MouseEvent) : void
        {
            if (event.currentTarget.name == "closeBtn")
            {
                dispatchEvent(new ClickCloseEvent());
            }
            else if (event.currentTarget.name == "fsBtn")
            {
                btnField.text = "";
                btnField.setTextFormat(fieldFormat);
                dispatchEvent(new ClickCloseEvent());
                dispatchEvent(new BookmarksDeleteBigImgEvent());
            }
            else if (event.currentTarget.name == "lArrow")
            {
                dispatchEvent(new ClickArrowEvent("prev"));
            }
            else if (event.currentTarget.name == "rArrow")
            {
                dispatchEvent(new ClickArrowEvent("next"));
            }
            return;
        }

    }
}
